<?php

/**
 * 自定义资料
 *
 * @package         YDCMS
 * @author          QQ:644157559 <644157559@qq.com>
 * @version         $Id: MylangModel.class.php v1.0 2014-06-13 17:27:03 $
 */
namespace Admin\Model;
class MylangModel extends CommonModel{
    protected $_validate = array(
        array("cid", "require", "说明不能为空！", 1),
        array("eid", "checkEid", "调用标识不能有中文！", 1, "callback"),
        array('lang', "checkLang", '语言选择有误！', 2, 'callback'), 
    );
    
    /**
     * 检查语言是否存在
     * @param type $lang
     * @return type
     */
    public function checkLang($lang) {
        return D("Language", "Service")->existLang($lang);
    }
    
    /**
     * 检查调用标识是否包含中文
     * @param type $val
     * @return type
     */
    public function checkEid($val) {
        $regexp = new \Org\Util\Regexp();
        $return = $regexp->CheckRegex($val, "zhongwen");
        return !$return;
    }
}
